// 新房间请求组件
<template>
  <div>
      <div v-for="req in sessions" class="notification">
        <h3 class="title">新的会话</h3>
        <div class="content" v-bind:id="req.name">
            <p>姓名:{{req.storeName}}</p>
            <p>手机:{{req.phoneNumber}}</p>
            <button class="btn btn-info" v-on:click="accept(req)">接受</button>
            <button class="btn btn-default" v-on:click="refuse(req)">拒绝</button>
        </div>
    </div>
</div>
</template>
<script>
import store from '../store'
import { mapState } from 'vuex'

export default {
    name:'Session',
    data:function(){
        return{
            
        }
    },
    methods:{
            accept: function(data) {
                store.commit('ACCEPT_ROOM',data)
                //stompClient.send("/app/event",{},JSON.stringify({type:"room",event:"accept",room_id:req.roomId}));
                //从req删除此房间请求提示
                //this.requests.splice(this.requests.indexOf(data),1);
            },
            //拒绝会话
            refuse: function(data){
                store.commit('REJECT_ROOM',data)
            },
    },
    computed:{
        ...mapState([
            'sessions'
        ])
    }
}
</script>
<style lang="less" scoped>
.notification {
    display: flex;
    width: 250px;
    padding: 14px 26px 14px 13px;
    border-radius: 8px;
    box-sizing: border-box;
    border: 1px solid #ebeef5;
    position: fixed;
    background-color: #fff;
    box-shadow: 0 2px 12px 0 rgba(0,0,0,.1);
    transition: opacity .3s,transform .3s,left .3s,right .3s,top .4s,bottom .3s;
    overflow: hidden;
    right: 16px;
    .title{
        font-weight: 700;
        font-size: 16px;
        color:black;
        margin: 0;
    }
    .content{
        font-size: 14px;
        line-height: 21px;
        margin: 6px 0 0;
        color: #606266;
        text-align: justify;
    }
}

</style>

